(()=>{((s,Ve,vr,kr=50,dt=50*1024,Ne=512*1024,_e=100,Sr=5*1024*1024,ve=50,mt=600*1e3,Tr=2e3)=>{const ht=s.__lovableEvents||{};if(ht.__userAppEventsSdkVersion)return;const b=s.document,De=s.navigator||{},gt=De.webdriver===!0||!!s.Cypress||!!s.__nightmare,k=s.performance||{now:()=>Date.now()},M=s.location||{pathname:"",href:"",search:""},Z=()=>s.setTimeout||(typeof setTimeout=="function"?setTimeout:null),ee=()=>s.clearTimeout||(typeof clearTimeout=="function"?clearTimeout:null);if((e=>e==="/__codex_token_check"||e.startsWith("/__l5e/"))(M.pathname))return;const w=b&&b.currentScript,yt=w?{kind:w.getAttribute("data-artifact-kind")||null,id:w.getAttribute("data-artifact-id")||null,commit_sha:w.getAttribute("data-commit-sha")||null,context_token:w.getAttribute("data-context-token")||null}:{},bt=w?.getAttribute("data-replay")||null,Er=w?.getAttribute("data-track-url")||"/__l5e/trackevents",wr=w?.getAttribute("data-replay-url")||"/__l5e/replay",xr=w?.getAttribute("data-replay-script-url")||"/__l5e/rrweb-record.js",_t=e=>{const t=typeof e=="string"?Number(e):0;return!Number.isFinite(t)||t<=0?0:t>=1?1:t},qe=_t(w?.getAttribute("data-replay-sample-rate")||null),ze=_t(w?.getAttribute("data-replay-crash-sample-rate")||null),Rr=w?.getAttribute("data-autocapture")==="1",vt=e=>{const t=new Uint8Array(e);if(s.crypto&&typeof s.crypto.getRandomValues=="function")s.crypto.getRandomValues(t);else for(let r=0;rArray.from(e,t=>t.toString(16).padStart(2,"0")).join(""),S=()=>{if(s.crypto&&typeof s.crypto.randomUUID=="function")return s.crypto.randomUUID();const e=vt(16);e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=kt(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`},$e=e=>{const t=vt(e);return t.every(r=>r===0)&&(t[t.length-1]=1),kt(t)},St=()=>({traceId:$e(16),rootSpanId:$e(8)}),Ge=S();let He=null,ke=S(),Je=0,te=St(),We=0,H=null;const Tt=[1e4,3e4,6e4,3e5];let Ke=0,Se=null;const Mr=144e5;let Ye=0,Te=!1;const Et=18e5;let J=null,Ee=0,wt=0,re=!1;const xt=(e=>{let t=2166136261;for(let r=0;r>>0)/4294967296})(Ge),V=qe>0&&xt0&&xte.replace(/[^\s]/gu,"*"),Fr=(e,t)=>{if(typeof t?.tagName=="string"&&t.tagName.toUpperCase()==="STYLE")return e;const r=t&&typeof t.closest=="function"?t.closest.bind(t):null;return r?.("[data-lovable-unmask]")?.matches?.(Pr)&&!r?.(`.rr-mask,${Ar}`)?e:It(e)},$=[];let ie=null,Le=!1,Lt=!1,At=!1,W=!1,jt=0,Ur=0;const Ct=Math.max(1,kr),Or=5,Br=200,Vr=/^project\.[a-z][a-z0-9_]{0,63}(\.[a-z][a-z0-9_]{0,63})*$/u,Nr=e=>{const t=vr[e];return typeof t=="number"&&t>0?t:Vr.test(e)?1:null},Pt=typeof TextEncoder=="function"?new TextEncoder:null,D=e=>Pt?Pt.encode(e).length:e.length,Ft=e=>JSON.stringify({envelope_schema_version:1,batch_id:S(),sent_at:new Date().toISOString(),sdk:{name:"lovable-user-app-events",version:Ve},automated:gt,artifact:yt,events:e}),Ut=e=>{const t=s.console;t&&typeof t.debug=="function"&&t.debug(`[lovable-analytics] ${e}`)},Dr=(e,t)=>{if((e===403||e===404)&&t==="rejected"){Le=!0,$.length=0,At||(At=!0,Ut(`events disabled for this page load (HTTP ${e})`));return}Lt||(Lt=!0,Ut(`event batch rejected (HTTP ${e})`))},Ot=64*1024,Bt=16*1024;let ce=0,Ze=0;const Vt=()=>{ce-=Ze,Ze=0},Nt=(e,t,r)=>{const n=D(t),l=Ot-(r.reserveBytes||0),a=!!r.keepalive&&ce+n<=l;a&&(ce+=n);let c=a;const m=()=>{c&&(c=!1,ce-=n)},v=s.Blob||(typeof Blob=="function"?Blob:null);if(a&&r.beacon&&De.sendBeacon&&v)try{if(De.sendBeacon(e,new v([t],{type:"application/json"}))){Ze+=n,c=!1;return}}catch{}const F=s.fetch||(typeof fetch=="function"?fetch:null);if(!F){m(),r.onNetworkError?.();return}try{Promise.resolve(F(e,{method:"POST",headers:{"content-type":"application/json"},body:t,...a?{keepalive:!0}:{}})).then(U=>{m(),r.onResponse?.(U)},()=>{m(),r.onNetworkError?.()}).catch(()=>{})}catch{m(),r.onNetworkError?.()}},qr=(e,t)=>{const r=e.filter(l=>{try{return JSON.stringify(l),!0}catch{return!1}});let n=0;for(;n=Bt?Math.min(dt,c):dt;for(;l-n>1&&D(a)>m;)l=n+Math.max(1,Math.floor((l-n)/2)),a=Ft(r.slice(n,l));Nt(Er,a,{keepalive:!0,beacon:t,onResponse:v=>{!v||v.ok!==!1||Dr(v.status,v.headers?.get?.("x-lovable-events")??null)}}),n=l}},et=(e,t,r)=>g?JSON.stringify({envelope_schema_version:1,replay_schema_version:1,replay_id:g,chunk_id:t,chunk_sequence:r,sent_at:new Date().toISOString(),sdk:{name:"lovable-user-app-events",version:Ve},automated:gt,artifact:yt,session_id:Ge,page_view_id:ke,events:e}):null,zr=e=>{const t=et([e],"00000000-0000-4000-8000-000000000000",A);return!!t&&D(t)<=Ne},Dt=e=>{const t=e&&typeof e=="object"?e:null;return typeof t?.type=="number"?t.type:null},tt=()=>Math.max(0,k.now()-Xe),qt=()=>{if(!le)return;const e=ee();e&&e(le),le=null},Ae=()=>{if(!xe)return;const e=ee();e&&e(xe),xe=null},rt=()=>{try{we?.()}catch{}finally{we=null,se=!1}},$r=e=>{switch(e){case"recorder_script_failed":return"recorder_script";case"recorder_start_failed":return"recorder_start";case"recorder_runtime_error":return"recorder_runtime";case"missing_full_snapshot":case"full_snapshot_too_large":return"snapshot";case"upload_failed":return"upload";default:return null}},zt=(e,t,r,n,l,a)=>{const c=$r(t);c&&E("lovable.replay_error",{replay_id:e,reason:t,stage:c,recorder:"rrweb",sample_rate:Mt,event_count:r,duration_ms:n,chunk_count:l,uploaded_bytes:a})},Gr=()=>!C||C==="sampled"?{}:{capture_reason:C,trigger_event_id:Me,trigger_event_name:Ie},$t=(e,t,r,n,l,a,c)=>{E("lovable.session_replay",{replay_id:e,status:t,reason:r,recorder:"rrweb",sample_rate:Mt,event_count:n,duration_ms:l,chunk_count:a,uploaded_bytes:c,...Gr()}),zt(e,r,n,l,a,c)},nt=(e,t)=>{g&&$t(g,e,t,R,tt(),A,z)},ot=()=>j||C==="sampled",at=(e,t,r,n,l,a,c)=>{ot()?$t(e,t,r,n,l,a,c):zt(e,r,n,l,a,c)},P=(e,t=!1)=>{!g||_||(rt(),Ae(),t&&(T.length=0,qt()),ot()&&nt("stopped",e),_=!0)},Gt=()=>{if(!(!g||_)){if(!j){rt(),Ae();return}P("duration_limit",!0)}},Ht=e=>{!g||_||C==="client_error"||(j=!0,C="client_error",Me=e,Ie="lovable.client_error",Jt())},Hr=()=>T.length>0||A>0||z>0,Jt=()=>!g||_||C!=="client_error"||Qe||!N||!Hr()?!1:(Qe=!0,nt("captured","client_error"),K(!0),!0),Wt=e=>{if(oe>0){ae=e;return}P(e,!0)},Kt=()=>{if(oe--,_||oe>0||!ae)return;const e=ae;ae=null,ne>0?Yt():P(e,!0)},K=(e=!1)=>{if(qt(),!(!j||!g||T.length===0||!N))for(;!_&&T.length>0;){let t=Math.min(T.length,_e);const r=S(),n=A;let l=et(T.slice(0,t),r,n);for(;l&&t>1&&D(l)>Ne;)t=Math.max(1,Math.floor(t/2)),l=et(T.slice(0,t),r,n);if(!l)return;const a=D(l);if(a>Ne){T.shift(),R=Math.max(0,R-1);continue}const c=A-ne;if(c>=ve||z+a>Sr){Wt(c>=ve?"chunk_limit":"size_limit");return}if(T.splice(0,t),A++,z+=a,oe++,Nt(wr,l,{keepalive:e,reserveBytes:Bt,onResponse:m=>{const v=m?.status===429;if(v&&(ne++,z-=a,R=Math.max(0,R-t)),Kt(),v||m&&m.ok!==!1)return;const F=m?.headers?.get?.("x-lovable-events");P(F==="unavailable"?"upload_unavailable":F==="rejected"?"upload_rejected":"upload_failed",!0)},onNetworkError:()=>{P("upload_failed",!0),Kt()}}),_)return;if(A-ne>=ve){Wt("chunk_limit");return}}},Yt=()=>{if(le)return;const e=Z();if(!e){K();return}le=e(K,Tr)},Jr=()=>{if(!ie)return;const e=ee();e&&e(ie),ie=null},Y=(e=!1)=>{if(Jr(),Le||$.length===0)return;const t=$.splice(0,Ct);qr(t,e||W),$.length>0&&Xt()},Xt=()=>{if(ie||Le)return;const e=Z();if(!e){Y();return}ie=e(Y,250)},Wr=()=>{H===null&&(H=k.now())},je=()=>{H=null},ue=()=>{const e=ee();Se!==null&&e&&e(Se),Se=null},Kr=()=>{if(H!==null){const t=k.now();We+=t-H,H=t}const e=Math.round(We);return We=0,e},fe=e=>{const t=Kr();if(t<=0)return;Ye+=t;const r=Ye>=Mr;r&&(Te=!0,je(),ue()),E("lovable.page_engagement",{reason:r?"capped":e,engagement_time_ms:t})},Qt=()=>{ue();const e=Z();if(!e)return;const t=Tt[Math.min(Ke,Tt.length-1)];Se=e(()=>{Ke++,fe("threshold"),!Te&&Qt()},t)},lt=()=>{const e=ee();J!==null&&(e&&e(J),Ee+=Math.max(0,k.now()-wt)),J=null},Zt=()=>{lt(),Ee=0},er=()=>{if(J!==null||!b||b.visibilityState==="hidden"||b.hasFocus?.()!==!1)return;const e=Z();e&&(wt=k.now(),J=e(()=>{J=null,Ee=Et,re=!0,fe("unfocused"),je(),ue()},Math.max(0,Et-Ee)))},pe=()=>{b&&b.visibilityState==="hidden"||re||Te||(Wr(),Ke=0,Qt(),er())},tr=()=>(fe("navigation"),Ye=0,Te=!1,pe(),ke=S(),te=St(),Je=0,ke),Yr=e=>e==="lovable.page_viewed"?{trace_id:te.traceId,span_id:te.rootSpanId}:{trace_id:te.traceId,span_id:$e(8),parent_span_id:te.rootSpanId},Xr=e=>e==="lovable.client_error"||e==="lovable.resource_error"||e==="lovable.replay_error",Qr=(e,t,r={})=>{if(Le)return null;if(Xr(e)&&++Ur>Br)return e==="lovable.client_error"&&Ht(null),null;const n=e==="lovable.client_error"&&jt=Ct?Y():Xt(),l},E=(e,t={})=>{const r=typeof e=="string"?Nr(e):null;return r===null?null:Qr(e,r,t)};let de=M.pathname;const Zr=(e,t={})=>(e==="lovable.page_viewed"&&(tr(),typeof t.url_path=="string"&&(de=t.url_path)),E(e,t)),st=e=>{try{return new URL(e,M.href).pathname}catch{return null}},rr=e=>{try{return new URL(e,M.href).host.replace(/^www\./iu,"")}catch{return null}},en=e=>{try{return new URL(e,M.href).protocol.replace(/:$/u,"")}catch{return null}},tn=[["utm_source","campaign_source"],["utm_medium","campaign_medium"],["utm_campaign","campaign_name"],["utm_term","campaign_term"],["utm_content","campaign_content"]],rn=["gclid","dclid","gbraid","wbraid","msclkid","ttclid","twclid","li_fat_id","fbclid"],nn=128,on=e=>{const t={};try{if(typeof e!="string"||!e)return t;const r=new URLSearchParams(e.replace(/;/gu,"&"));for(const[l,a]of tn){const c=r.get(l);if(typeof c!="string")continue;const m=c.trim();m&&D(m)<=nn&&(t[a]=m)}const n=rn.filter(l=>{const a=r.get(l);return typeof a=="string"&&a.trim()!==""});n.length>0&&(t.campaign_click_id_types=n)}catch{return{}}return t},nr=(e,t)=>{let r=e;for(;r&&D(JSON.stringify(r))>t;)r=r.slice(0,Math.floor(r.length*.8));return r},me=(e,t)=>{if(typeof e!="string")return null;const r=e.replace(/\s+/gu," ").trim();if(!r)return null;if(r.length<=t)return r;const n=Array.from(r);return n.length>t?n.slice(0,t).join(""):r},an=2048,or=()=>me(M.pathname||"/",an)||"/",it=e=>{const t=e&&typeof e=="object"?e:null,r=a=>typeof a=="string"?a:typeof a=="number"||typeof a=="boolean"||typeof a=="bigint"?String(a):null,n=r(t?.stack),l=r(t?.message)||r(e)||"Unknown error";return{message:nr(l.slice(0,2e3),2048),name:r(t?.name),stack:n?nr(n.slice(0,8e3),8192):null}},ar=1e3,ln=1e4,lr=10,Ce=new Map,he=[],sr=(e,t)=>{for(const[r,n]of Ce)t-n>=ar&&Ce.delete(r);Ce.set(e,t)},ct=(e,t=!0)=>{t&&tr();const r=M.pathname,n={url_path:r,navigation_type:e};typeof b?.referrer=="string"&&b.referrer&&(n.referrer_host=rr(b.referrer)??"",n.referrer_path=st(b.referrer)??""),Object.assign(n,on(M.search)),de=r,sr(r,k.now()),E("lovable.page_viewed",n)},ut=e=>{M.pathname!==de&&ct(e)},sn=()=>{const e=M.pathname;if(e===de)return;const t=k.now(),r=Ce.get(e);if(r!==void 0&&t-rlr+1&&he.shift(),he.length>lr&&t-he[0]{const e=bt==="rrweb"&&Rt&&s.rrweb&&typeof s.rrweb.record=="function"?s.rrweb.record:null;if(!(!e||g)){g=S(),Xe=k.now(),_=!1,A=0,ne=0,oe=0,ae=null,z=0,se=!1,N=!1,j=V,C=V?"sampled":null,Me=null,Ie=null,Qe=!1;try{const t=e({emit(n){if(_||!n||typeof n!="object")return;if(tt()>=mt){Gt();return}const l=Dt(n);if(!zr(n)){l===2&&!N&&P("full_snapshot_too_large",!0);return}if(!(l===3&&!N)){for(l===2&&(N=!0),R+=1,T.push(n);!j&&T.length>Lr;){const a=T.findIndex(c=>Dt(c)!==2);T.splice(a>=0?a:0,1),R=Math.max(0,R-1)}Jt()||j&&(T.length>=_e?K():Yt())}},blockClass:"rr-block",blockSelector:jr,collectFonts:!1,ignoreClass:"rrweb-ignore",ignoreSelector:Cr,inlineImages:!1,maskAllInputs:!0,maskInputFn:It,maskInputOptions:{checkbox:!1,color:!1,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,radio:!1,range:!1,search:!0,select:!0,tel:!0,text:!0,textarea:!0,time:!0,url:!0,week:!0},maskTextClass:"rr-mask",maskTextFn:Fr,maskTextSelector:"*",recordAfter:"load",recordCanvas:!1,recordCrossOriginIframes:!1});if(_){if(typeof t=="function")try{t()}catch{}return}se=!0,typeof t=="function"&&(we=t);const r=Z();r&&typeof e.takeFullSnapshot=="function"&&r(()=>{if(!(!g||_))try{e.takeFullSnapshot?.(!1)}catch{}},1e3),r&&(xe=r(Gt,mt)),ot()&&nt("started","recorder_available")}catch{g&&at(g,"stopped","recorder_start_failed",R,tt(),A,z),g=null,R=0,Xe=0,_=!1,N=!1,j=V,C=V?"sampled":null,Me=null,Ie=null,we=null,se=!1,Ae()}}},cn=()=>{if(bt!=="rrweb"||!Rt||g||Re)return;if(s.rrweb&&typeof s.rrweb.record=="function"){ir();return}const e=b?.head;if(!b?.createElement||!e?.appendChild)return;const t=b.createElement("script");Re=!0,t.async=!0,t.src=xr,t.onload=()=>{if(Re=!1,!s.rrweb||typeof s.rrweb.record!="function"){at(S(),"stopped","recorder_script_failed",0,0,0,0);return}ir()},t.onerror=()=>{Re=!1,at(S(),"stopped","recorder_script_failed",0,0,0,0)},e.appendChild(t)},un=e=>{if(!(!g||_)){if(rt(),Ae(),!N){P("missing_full_snapshot",!0);return}K(!0),_||P(e)}},fn=e=>{if(!g||_)return;const t=e&&typeof e=="object"?e:null,r=t?.error&&typeof t.error=="object"?t.error:null,n=typeof t?.filename=="string"?t.filename:"",l=typeof r?.stack=="string"?r.stack:"";(n.includes("/__l5e/rrweb-record")||l.includes("/__l5e/rrweb-record"))&&P("recorder_runtime_error",!0)},pn=(e,t)=>{const n={CLS:[.1,.25],FCP:[1800,3e3],INP:[200,500],LCP:[2500,4e3],TTFB:[800,1800]}[e];return!n||t<=n[0]?"good":t<=n[1]?"needs-improvement":"poor"},dn=e=>e==="CLS"?"score":"millisecond",I=(e,t)=>{const r=e[t];return typeof r=="number"&&Number.isFinite(r)?r:null},Pe=(e,t)=>{const r=s.PerformanceObserver;if(!r)return!1;const n=r.supportedEntryTypes;if(Array.isArray(n)&&!n.includes(e))return!1;try{return new r(a=>{const c=typeof a.getEntries=="function"?a.getEntries():[];for(const m of c)m&&typeof m=="object"&&t(m)}).observe(e==="event"?{type:e,buffered:!0,durationThreshold:40}:{type:e,buffered:!0}),!0}catch{return!1}},mn=()=>{const e=or(),t=(u,p,L=p,ft=S())=>{!Number.isFinite(p)||p<0||E("lovable.web_vital",{url_path:e,metric:u,value:p,unit:dn(u),delta:L,rating:pn(u,p),id:ft,navigation_type:"initial_load"})};let r=!1,n=null,l=0,a=0,c=!1;const m={},v={},F=u=>(m[u]=m[u]||S(),m[u]),U=(u,p)=>{if(v[u]===p)return;const L=v[u];v[u]=p,t(u,p,L===void 0?p:p-L,F(u))},ge=typeof k.getEntriesByType=="function"?k.getEntriesByType("navigation"):[],O=ge[0]&&typeof ge[0]=="object"?ge[0]:null,B=O?I(O,"responseStart"):null,Fe=O?I(O,"requestStart"):null,Ue=O?I(O,"fetchStart"):null,X=Fe??Ue;B!==null&&X!==null&&B>=X&&t("TTFB",B-X),Pe("paint",u=>{if(r||u.name!=="first-contentful-paint")return;const p=I(u,"startTime");p!==null&&(r=!0,t("FCP",p))}),Pe("largest-contentful-paint",u=>{n=I(u,"startTime")??I(u,"renderTime")??I(u,"loadTime")??n});const Oe=Pe("layout-shift",u=>{if(u.hadRecentInput===!0)return;const p=I(u,"value");p!==null&&(l+=p)});return Pe("event",u=>{const p=I(u,"interactionId");if(p===null||p<=0)return;const L=I(u,"duration");L!==null&&L>a&&(a=L)}),(u=!1)=>{c||(n!==null&&U("LCP",n),Oe&&U("CLS",l),a>0&&U("INP",a),u&&(c=!0))}},cr=(e,t)=>{const r=s.history,n=r&&r[e];!r||typeof n!="function"||(r[e]=function(...l){const a=n.apply(this,l);return t(),a})},hn=e=>{const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=typeof t.mechanism=="string"?t.mechanism:"manual",n=typeof t.severity=="string"?t.severity:"error";return{mechanism:["manual","onerror","unhandledrejection","react_error_boundary"].includes(r)?r:"manual",handled:typeof t.handled=="boolean"?t.handled:!0,severity:["error","warning","info"].includes(n)?n:"error"}};s.__lovableEvents=Object.assign(ht,{__userAppEventsSdkVersion:Ve,track:Zr,flush:()=>Y(),identify(e){const t=e&&typeof e=="object"?e:null;He=typeof t?.user_id=="string"?t.user_id:null},getIdentity(){return{app_user_id_hash_available:!!He}},getReplay(){return{replay_id:g,active:!!g&&!_&&se,event_count:R}},resetIdentity(){He=null},captureException(e,t={},r={}){const n=it(e),l=hn(r);let a=t&&typeof t=="object"&&!Array.isArray(t)?t:{};try{D(JSON.stringify(a))>4096&&(a={})}catch{a={}}E("lovable.client_error",{occurrence_id:S(),...n,...l,context:a})},startSpan(e,t={}){const r=new Date().toISOString(),n=k.now();return{end(l="ok"){E("lovable.frontend_span",{name:e,start_time:r,status:l,duration_ms:Math.max(0,k.now()-n),attributes:t})}}}}),s.addEventListener&&s.addEventListener("error",fn,!0),cn();const ur=mn();if(s.addEventListener&&(s.addEventListener("error",e=>{const t=e&&typeof e=="object"?e:null,r=t?.target&&typeof t.target=="object"?t.target:null;let n=null;if(r&&r!==s&&(typeof r.src=="string"?n=r.src:typeof r.href=="string"&&(n=r.href)),n!==null){const a=typeof r?.tagName=="string"?r.tagName.toLowerCase():"unknown",c=rr(n);E("lovable.resource_error",{resource_type:a,url_host:c||en(n)||"unknown",failure_type:"load_error",element:a,url_path:c?st(n):null,mechanism:"resource_load",handled:!1,severity:"error"});return}const l=it(t?.error||t?.message);E("lovable.client_error",{occurrence_id:S(),...l,filename:typeof t?.filename=="string"?st(t.filename):null,lineno:typeof t?.lineno=="number"?t.lineno:null,colno:typeof t?.colno=="number"?t.colno:null,mechanism:"onerror",handled:!1,severity:"error"})},!0),s.addEventListener("unhandledrejection",e=>{const r=it((e&&typeof e=="object"?e:null)?.reason);E("lovable.client_error",{occurrence_id:S(),...r,mechanism:"unhandledrejection",handled:!1,severity:"error"})}),s.addEventListener("pagehide",()=>{W=!0,ur(!0),un("pagehide"),fe("pagehide"),je(),ue(),lt(),Y(!0)}),s.addEventListener("blur",()=>er()),s.addEventListener("focus",()=>{Zt(),re&&(re=!1,pe())}),s.addEventListener("pageshow",e=>{(e&&typeof e=="object"?e.persisted:!1)===!0&&(W=!1,Vt(),Zt(),re=!1,pe())}),s.addEventListener("popstate",()=>ut("popstate")),s.addEventListener("hashchange",()=>ut("hashchange")),Rr)){const v={select:!0,textarea:!0,input:!0},F={button:!0,a:!0,input:!0,select:!0,textarea:!0,summary:!0},U={button:!0,link:!0,menuitem:!0,menuitemcheckbox:!0,menuitemradio:!0,tab:!0,switch:!0,checkbox:!0,radio:!0,option:!0},ge={header:!0,footer:!0,main:!0,nav:!0,aside:!0,section:!0,article:!0,form:!0},O=typeof Symbol<"u"&&typeof Symbol.for=="function"?Symbol.for("__jsxSource__"):null,B=o=>o&&typeof o=="object"&&typeof o.tagName=="string"?o:null,Fe={};for(const o of"html body div span main header footer nav aside section article form p a button input select textarea label fieldset legend optgroup option datalist output progress meter ul ol li dl dt dd table thead tbody tfoot tr td th caption col colgroup h1 h2 h3 h4 h5 h6 br hr pre blockquote figure figcaption small strong em b i u s q cite abbr code kbd samp var mark sub sup time address details summary dialog menu picture source track canvas iframe object embed param map area img video audio template slot noscript script style link meta title base head ins del ruby rt rp bdi bdo wbr data hgroup search fencedframe svg path g circle rect line polyline polygon ellipse text textpath tspan defs use symbol clippath mask pattern lineargradient radialgradient stop filter foreignobject marker image view desc animate animatetransform animatemotion set fegaussianblur feoffset feblend fecolormatrix fecomposite feflood femerge femergenode femorphology fetile feturbulence fedropshadow fedisplacementmap".split(" "))Fe[o]=!0;const Ue={};for(const o of"button link menuitem menuitemcheckbox menuitemradio tab switch checkbox radio option combobox listbox textbox searchbox slider spinbutton treeitem gridcell row columnheader rowheader tooltip dialog alertdialog navigation main banner contentinfo complementary region form search article list listitem table grid tree menu menubar toolbar tabpanel tablist progressbar status alert log timer none presentation".split(" "))Ue[o]=!0;const X={};for(const o of"button submit reset checkbox radio text password email number tel url search date time datetime-local month week color file range hidden image".split(" "))X[o]=!0;const Oe=(o,i)=>o!==null&&i[o.toLowerCase()]===!0?o.toLowerCase():null,u=o=>{const i=String(o.tagName).toLowerCase();return Fe[i]===!0?i:"x"},p=(o,i)=>{if(typeof o.getAttribute!="function")return null;const d=o.getAttribute(i);return typeof d=="string"&&d!==""?d:null},L=(o,i)=>typeof o.getAttribute=="function"&&typeof o.getAttribute(i)=="string",ft=o=>{if(v[u(o)]===!0)return null;const i=o.childNodes;if(!i||typeof i.length!="number")return null;const d=i;let f="";for(let y=0;y200)return null}return f===""?null:f},gn=o=>me(p(o,"aria-label")||p(o,"title")||p(o,"alt")||ft(o),64),yn=(o,i,d)=>{const f=o.children;if(!f||typeof f.length!="number")return"";const y=f;let h=0,x=0;for(let q=0;q0?":"+h:""},bn=o=>{const i=[];let d=o;for(let y=0;d&&y<32;y++){const h=u(d);if(!h||h==="html")break;const x=B(d.parentElement);if(i.unshift(x&&h!=="body"?h+yn(x,d,h):h),h==="body"||!x)break;d=x}if(i.length===0)return null;let f=i.join(">");for(;f.length>1024&&i.length>1;)i.shift(),f=i.join(">");return f.length>1024?f.slice(f.length-1024):f},_n=o=>{if(O===null)return null;const i=o[O];if(!i||typeof i!="object")return null;const d=i.displayName;return typeof d=="string"&&d!==""?d:null},vn=o=>{if(F[u(o)]===!0)return!0;const i=p(o,"role");return i!==null&&U[i.toLowerCase()]===!0},kn=(o,i)=>{const d=typeof o.composedPath=="function"?o.composedPath():null;if(Array.isArray(d)){const h=[];for(const x of d){if(h.length>=i)return{nodes:h,complete:!1};const q=B(x);q&&h.push(q)}return{nodes:h,complete:!0}}const f=[];let y=B(o.target);for(;y;){if(f.length>=i)return{nodes:f,complete:!1};f.push(y),y=B(y.parentElement)}return{nodes:f,complete:!0}},fr=o=>o==="mouse"||o==="touch"||o==="pen",Sn=2e3,Tn=300;let pt="",pr=0;const dr=o=>pt!==""&&k.now()-pr<=o?pt:"";s.addEventListener("pointerdown",o=>{try{const i=o;if(i.isTrusted!==!0)return;const d=typeof i.pointerType=="string"?i.pointerType:"";fr(d)&&(pt=d,pr=k.now())}catch{}},!0);const mr=o=>Math.round(o*1e3)/1e3,ye=o=>typeof o=="number"&&isFinite(o)?o:null;s.addEventListener("click",o=>{try{if(!o||typeof o!="object")return;const i=o;if(i.isTrusted!==!0||Je>=200)return;const d=kn(i,512);if(!d.complete)return;let f=null,y=null;for(let Be=0;Be=32)){if(f===null){vn(be)&&(f=be);continue}y===null&&ge[u(be)]===!0&&(y=be)}}if(f===null)return;const h=typeof i.pointerType=="string"?i.pointerType:"",x=ye(i.detail)??0,q=x===0?dr(Tn):"",Q=fr(h)?h:q||(x===0?"keyboard":dr(Sn)||"unknown");let hr=null,gr=null;const yr=ye(i.clientX),br=ye(i.clientY),G=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;Q!=="keyboard"&&G&&yr!==null&&br!==null&&G.width>0&&G.height>0&&(hr=mr(Math.min(1,Math.max(0,(yr-G.left)/G.width))),gr=mr(Math.min(1,Math.max(0,(br-G.top)/G.height))));const _r=s;E("lovable.element_clicked",{url_path:or(),element_tag:u(f),interaction_type:Q,element_role:Oe(p(f,"role"),Ue),element_type:Oe(p(f,"type"),X),element_label:gn(f),element_path:bn(f),component_name:me(_n(f),64),section_tag:y?me(u(y),64):null,section_label:y?me(p(y,"aria-label"),64):null,offset_x:hr,offset_y:gr,viewport_width:ye(_r.innerWidth),viewport_height:ye(_r.innerHeight)}),Je++}catch{}},!0)}b&&typeof b.addEventListener=="function"&&b.addEventListener("visibilitychange",()=>{if(b.visibilityState==="hidden"){W=!0,ur(),K(!0),fe("hidden"),je(),ue(),lt(),Y(!0),W=!1;return}W=!1,Vt(),pe()}),cr("pushState",()=>ut("push_state")),cr("replaceState",sn),E("lovable.session_started",{reason:"new_session"}),ct("initial_load",!1),pe()})(window, "0.3.0-automated-flag", {"lovable.webmcp_tool_invoked":1,"lovable.session_started":1,"lovable.page_viewed":1,"lovable.client_error":1,"lovable.frontend_span":1,"lovable.interaction":1,"lovable.element_clicked":1,"lovable.form_submitted":1,"lovable.resource_error":1,"lovable.session_replay":1,"lovable.replay_error":1,"lovable.web_vital":1,"lovable.page_engagement":1}, 50, 51200, 524288, 100, 5242880, 50, 600000, 2000);})();